home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / admin / dig-2.0 / dig-2 / dig.2.0 / res.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-09-01  |  3.2 KB  |  127 lines

  1. /*
  2.  * Copyright (c) 1985 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that this notice is preserved and that due credit is given
  7.  * to the University of California at Berkeley. The name of the University
  8.  * may not be used to endorse or promote products derived from this
  9.  * software without specific prior written permission. This software
  10.  * is provided ``as is'' without express or implied warranty.
  11.  *
  12.  *    @(#)res.h    5.3 (Berkeley) 2/17/88
  13.  */
  14.  
  15. /*
  16. ** Distributed with 'dig' version 2.0 from University of Southern
  17. ** California Information Sciences Institute (USC-ISI). 9/1/90
  18. */
  19.  
  20. /*
  21.  *******************************************************************************
  22.  *
  23.  *  res.h --
  24.  *
  25.  *    Definitions used by modules of the name server 
  26.  *    lookup program.
  27.  *
  28.  *    Copyright (c) 1985 
  29.  *      Andrew Cherenson
  30.  *      CS298-26  Fall 1985
  31.  *  
  32.  *******************************************************************************
  33.  */
  34.  
  35. #define TRUE    1
  36. #define FALSE    0
  37.  
  38. /*
  39.  *  Define return statuses in addtion to the ones defined in namserv.h
  40.  *   let SUCCESS be a synonym for NOERROR
  41.  *
  42.  *    TIME_OUT    - a socket connection timed out.
  43.  *    NO_INFO        - the server didn't find any info about the host.
  44.  *    ERROR        - one of the following types of errors:
  45.  *               dn_expand, res_mkquery failed
  46.  *               bad command line, socket operation failed, etc.
  47.  *    NONAUTH        - the server didn't have the desired info but
  48.  *              returned the name(s) of some servers who should.
  49.  *
  50.  */
  51.  
  52. #define  SUCCESS        0
  53. #define  TIME_OUT        -1
  54. #define  NO_INFO         -2
  55. #define  ERROR             -3
  56. #define  NONAUTH         -4
  57.  
  58. /*
  59.  *  Define additional options for the resolver state structure.
  60.  *
  61.  *   RES_DEBUG2        more verbose debug level 
  62.  */
  63.  
  64. #define RES_DEBUG2    0x80000000
  65.  
  66. /*
  67.  *  Maximum length of server, host and file names.
  68.  */
  69.  
  70. #define NAME_LEN 80
  71.  
  72.  
  73. /*
  74.  * Modified struct hostent from <netdb.h>
  75.  *
  76.  * "Structures returned by network data base library.  All addresses
  77.  * are supplied in host order, and returned in network order (suitable
  78.  * for use in system calls)."
  79.  */
  80.  
  81. typedef struct    {
  82.     char    *name;        /* official name of host */
  83.     char    **domains;    /* domains it serves */
  84.     char    **addrList;    /* list of addresses from name server */
  85. } ServerInfo;
  86.  
  87. typedef struct    {
  88.     char    *name;        /* official name of host */
  89.     char    **aliases;    /* alias list */
  90.     char    **addrList;    /* list of addresses from name server */
  91.     int    addrType;    /* host address type */
  92.     int    addrLen;    /* length of address */
  93.     ServerInfo **servers;
  94. } HostInfo;
  95.  
  96.  
  97. /*
  98.  *  SockFD is the file descriptor for sockets used to connect with
  99.  *  the name servers. It is global so the Control-C handler can close
  100.  *  it. Likewise for filePtr, which is used for directing listings
  101.  *  to a file.
  102.  */
  103.  
  104. extern int sockFD;
  105. extern FILE *filePtr;
  106.  
  107.  
  108. /*
  109.  *  External routines:
  110.  */
  111.  
  112. extern int   Print_query();
  113. extern char *Print_cdname();
  114. extern char *Print_cdname2();    /* fixed width */
  115. extern char *Print_rr();
  116. extern char *DecodeType();    /* descriptive version of p_type */
  117. extern char *DecodeError();
  118. extern char *Calloc();
  119. extern void NsError();
  120. extern void PrintServer();
  121. extern void PrintHostInfo();
  122. extern void ShowOptions();
  123. extern void FreeHostInfoPtr();
  124. extern FILE *OpenFile();
  125. extern char *inet_ntoa();
  126. extern char *res_skip();
  127.